# -*- coding: utf-8 -*-
"""
@Time ： 2021/7/29 22:01
@Auth ： Mr.掌心 2929184523
@Company ：特斯汀学院 @testingedu.com.cn
@Function ：请输入模块功能描述
"""
from PO.pages.base_page import BasePage


class UserPage(BasePage):
    UserPage_locators = {
        '_user_img_locator': '//*[@id="preview"]',
        '_user_img_iframe_locator': '//*[@id="layui-layer-iframe1"]',
        '_upload_img_locator': '//*[@id="filePicker"]/div[2]/input',
        '_use_img_locator': '//div[@class="saveBtn"]',
        '_save_img_locator': '//input[@class="save"]'
    }

    def change_user_img(self, path):
        self.driver.get('http://testingedu.com.cn:8000/Home/User/info.html')
        self.clickjs(self.UserPage_locators['_user_img_locator'])
        self.intoiframe(self.UserPage_locators['_user_img_iframe_locator'])
        self.input(self.UserPage_locators['_upload_img_locator'], path)
        self.clickjs(self.UserPage_locators['_use_img_locator'])
        self.outiframe()
        self.clickjs(self.UserPage_locators['_save_img_locator'])

